<?php
include "dbinfo.php";
session_start();
$self = $_SERVER['PHP_SELF'];
$ipaddress = ("$_SERVER[REMOTE_ADDR]");

if(isset($_POST['createEvent'])) {
	header("location:registrate.php");
}

$query = "SELECT * FROM events";
$connect = mysqli_connect($databaseHost,$databaseUsername,$databasePassword,$databaseName) or die('<p class="error">[1]Unable to connect to the database server at this time.</p>');
$result = mysqli_query($connect, $query) or die('<p class="error">[2]There was an unexpected error grabbing info from the database.</p>');
?>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title></title>
<meta name="robots" content="noindex,nofollow" />

</head>
<body>

	<form action="<?php $self ?>" method="post">
		<input type="submit" name="createEvent" value="Create" />
	</form>
	<table border="1">
		<?php
		while ($row = mysqli_fetch_array($result)) {

		$title = stripslashes($row['title']);
		$date = stripslashes($row['date']);
		$venue = stripslashes($row['venue']);
		$desc = stripslashes($row['description']);

		echo("<tr><td WIDTH='200'>$title</td><td WIDTH='200'>$date</td><td WIDTH='200'>$venue</td><td WIDTH='200'>$desc</td></tr>");
	}
	?>
	</table>
</body>